// $Id: bloomfilterbit.h 54 2004-10-11 15:31:22Z jonas $
#ifndef BLOOMFILTERBIT_H
#define BLOOMFILTERBIT_H

#include "bloomfilter.h"
// #include "file.h"
// #include "storedfile.h"

// TODO: Fine tune these parameters!
const int bloomFilterBitCount = 10000;

/**
 * This implementation of the bloom filter stores a sequence of bits which can
 * be get and set (internal operations) in order to remember files.
 */
class BloomFilterBit : public BloomFilter {
public:
	BloomFilterBit();
	BloomFilterBit(const BloomFilterBit &);
	virtual ~BloomFilterBit();

	BloomFilter *newCopy();
	unsigned int calcDistance(unsigned int);
	void update(unsigned int, std::map<File *, StoredFile *> &);
	void rebuild(std::map<File *, StoredFile *> &);
	//void rebuild(std::list<RoutingEntry> &);

private:
	bool getBit(int);
	void setBit(int, bool);
	int getIndex(int);

	unsigned char *bits;
};

#endif
